<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Story
 *
 * @author Zoila
 */
class Story extends AppModel {
    
    public $validate = array(
        'summary' => array(
            'rule' => 'notEmpty'
        )
    );
    
    public $belongsTo = array(
        'Project' => array(
            'className'    => 'Project',
            'foreignKey'   => 'project_id'
        )
    );
    
    public $hasMany = array(
        'MemberPoint' => array(
            'className'  => 'MemberPoint',
            'foreignKey' => 'story_id'
        )
    );
   
    public function isOwnedBy($st, $user) {
        return $this->field('id', array('id' => $st, 'creator_id' => $user)) === $st;
    }
}
?>
